var __extends =
    (this && this.__extends) ||
    (function () {
      var t = function (e, i) {
        return (t =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (t, e) {
              t.__proto__ = e;
            }) ||
          function (t, e) {
            for (var i in e)
              Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
          })(e, i);
      };
      return function (e, i) {
        function n() {
          this.constructor = e;
        }
        if ("function" != typeof i && null !== i)
          throw new TypeError(
            "Class extends value " + String(i) + " is not a constructor or null"
          );
        t(e, i),
          (e.prototype =
            null === i
              ? Object.create(i)
              : ((n.prototype = i.prototype), new n()));
      };
    })(),
  AXPropertyView = (function (t) {
    function e() {
      var i = t.call(this) || this;
      return (
        (i.onLoadSuboarDetailDataFn = {
          caller: i,
          code: 1005,
          method: function (t) {
            0 == t.code
              ? ((i.one_MinValue = t.data.hpp),
                (i.two_MinValue = t.data.mpp),
                (i.three_MinValue = t.data.app),
                (i.four_MinValue = t.data.spp),
                (i.currentValue_one = t.data.hpp),
                (i.currentValue_two = t.data.mpp),
                (i.currentValue_three = t.data.app),
                (i.currentValue_four = t.data.spp),
                (i.lbl_shuxing_qixue.text = t.data.maxHp),
                (i.lbl_shuxing_tizhi.text = "" + t.data.hpp),
                (i.lbl_shuxing_fangyu.text = "防御：" + t.data.df),
                (i.lbl_qixue_jingli.text = "" + t.data.maxMp),
                (i.lbl_shuxing_zhilidian.text = "" + t.data.mpp),
                (i.lbl_shuxing_gongji.text = "" + t.data.ap),
                (i.lbl_shuxing_liliangdian.text = "" + t.data.app),
                (i.lbl_shuxing_sudu.text = "" + t.data.sp),
                (i.lbl_shuxing_minjiedian.text = "" + t.data.spp),
                1 == i.obj_type ? i.MainHeroUI() : i.SubHeroUI(),
                WebSocketService.send({ c: 1e3, d: null }),
                i.distribute_state &&
                  ((i.distribute_state = !0),
                  ToastView.toastView(
                    "已为您分配的属性点配置好，快去开启新征程吧！"
                  )))
              : ToastView.toastView(t.msg);
          },
        }),
        (i.onLoadSuboarFuJiangDataFn = {
          caller: i,
          code: 1105,
          method: function (t) {
            0 == t.code
              ? (WebSocketService.send({ c: 1009, d: { id: i.objJson.id } }),
                e.propertyView && ToastView.toastView("属性加点成功"),
                null != t.data &&
                  ((i.one_MinValue = t.data.hpp),
                  (i.two_MinValue = t.data.mpp),
                  (i.three_MinValue = t.data.app),
                  (i.four_MinValue = t.data.spp),
                  (i.currentValue_one = t.data.hpp),
                  (i.currentValue_two = t.data.mpp),
                  (i.currentValue_three = t.data.app),
                  (i.currentValue_four = t.data.spp),
                  (i.lbl_shuxing_qixue.text = t.data.maxHp),
                  (i.lbl_shuxing_tizhi.text = "" + t.data.hpp),
                  (i.lbl_shuxing_fangyu.text = "防御：" + t.data.df),
                  (i.lbl_qixue_jingli.text = "" + t.data.maxMp),
                  (i.lbl_shuxing_zhilidian.text = "" + t.data.mpp),
                  (i.lbl_shuxing_gongji.text = "" + t.data.ap),
                  (i.lbl_shuxing_liliangdian.text = "" + t.data.app),
                  (i.lbl_shuxing_sudu.text = "" + t.data.sp),
                  (i.lbl_shuxing_minjiedian.text = "" + t.data.spp)))
              : ToastView.toastView(t.msg);
          },
        }),
        i.btn_proeprty_Cancle.on(Laya.Event.CLICK, i, i.onCancleFn),
        i.btn_proeprty_Sure.on(Laya.Event.CLICK, i, i.onAddPropertyPointFn),
        i.btn_del_ten_one.on(Laya.Event.CLICK, i, i.onPropertyDidClick),
        i.btn_del_one.on(Laya.Event.CLICK, i, i.onPropertyDidClick),
        i.btn_add_ten_one.on(Laya.Event.CLICK, i, i.onPropertyDidClick),
        i.btn_add_one.on(Laya.Event.CLICK, i, i.onPropertyDidClick),
        i.btn_del_ten_two.on(Laya.Event.CLICK, i, i.onPropertyDidClick),
        i.btn_del_two.on(Laya.Event.CLICK, i, i.onPropertyDidClick),
        i.btn_add_ten_two.on(Laya.Event.CLICK, i, i.onPropertyDidClick),
        i.btn_add_two.on(Laya.Event.CLICK, i, i.onPropertyDidClick),
        i.btn_del_ten_three.on(Laya.Event.CLICK, i, i.onPropertyDidClick),
        i.btn_del_three.on(Laya.Event.CLICK, i, i.onPropertyDidClick),
        i.btn_add_ten_three.on(Laya.Event.CLICK, i, i.onPropertyDidClick),
        i.btn_add_three.on(Laya.Event.CLICK, i, i.onPropertyDidClick),
        i.btn_del_ten_four.on(Laya.Event.CLICK, i, i.onPropertyDidClick),
        i.btn_del_four.on(Laya.Event.CLICK, i, i.onPropertyDidClick),
        i.btn_add_ten_four.on(Laya.Event.CLICK, i, i.onPropertyDidClick),
        i.btn_add_four.on(Laya.Event.CLICK, i, i.onPropertyDidClick),
        WebSocketService.addListener(i.onLoadSuboarDetailDataFn, !0),
        WebSocketService.addListener(i.onLoadSuboarFuJiangDataFn, !0),
        i
      );
    }
    return (
      __extends(e, t),
      (e.showPropertyView = function (t, i, n) {
        null == this.propertyView && (this.propertyView = new e()),
          this.propertyView.popup(!0),
          (this.propertyView.restValue = t),
          (this.propertyView.obj_type = i),
          (this.propertyView.distribute_state = !1),
          1 == i
            ? (WebSocketService.send({
                c: 1005,
                d: { ap: 0, hp: 0, mp: 0, sp: 0 },
              }),
              this.propertyView.initMainHeroUI())
            : ((this.propertyView.objJson = n),
              this.propertyView.initSubHeroUI());
      }),
      (e.prototype.initSubHeroUI = function () {
        (this.lbl_rest_shuxing.text = this.restValue + ""),
          (this.lbl_shuxing_qixue.text = this.objJson.maxHp),
          (this.lbl_shuxing_fangyu.text = "防御:" + this.objJson.df),
          (this.lbl_shuxing_tizhi.text = this.objJson.hpp),
          (this.lbl_qixue_jingli.text = this.objJson.maxMp),
          (this.lbl_shuxing_zhilidian.text = this.objJson.mpp),
          (this.lbl_shuxing_gongji.text = this.objJson.ap),
          (this.lbl_shuxing_liliangdian.text = this.objJson.app),
          (this.lbl_shuxing_sudu.text = this.objJson.sp),
          (this.lbl_shuxing_minjiedian.text = this.objJson.spp),
          this.SubHeroUI(),
          (this.one_MinValue = this.objJson.hpp),
          (this.two_MinValue = this.objJson.mpp),
          (this.three_MinValue = this.objJson.app),
          (this.four_MinValue = this.objJson.spp);
      }),
      (e.prototype.SubHeroUI = function () {
        (this.lbl_one_num.text = "0"),
          (this.lbl_two_num.text = "0"),
          (this.lbl_three_num.text = "0"),
          (this.lbl_four_num.text = "0"),
          (this.currentValue_one = this.objJson.hpp),
          (this.currentValue_two = this.objJson.mpp),
          (this.currentValue_three = this.objJson.app),
          (this.currentValue_four = this.objJson.spp),
          (this.lbl_one_current.text = "（+0）"),
          (this.lbl_two_current.text = "（+0）"),
          (this.lbl_three_current.text = "（+0）"),
          (this.lbl_four_current.text = "（+0）");
      }),
      (e.prototype.MainHeroUI = function () {
        (this.lbl_one_num.text = "0"),
          (this.lbl_two_num.text = "0"),
          (this.lbl_three_num.text = "0"),
          (this.lbl_four_num.text = "0"),
          (this.lbl_one_current.text = "（+0）"),
          (this.lbl_two_current.text = "（+0）"),
          (this.lbl_three_current.text = "（+0）"),
          (this.lbl_four_current.text = "（+0）");
      }),
      (e.prototype.initMainHeroUI = function () {
        this.lbl_rest_shuxing.text = this.restValue + "";
        var t = parseInt(Global.roleLvl);
        (this.lbl_shuxing_qixue.text = "" + 360 * t),
          (this.lbl_shuxing_fangyu.text = "防御:" + Global.roleDef),
          (this.lbl_qixue_jingli.text = "精力：" + Global.roleMp),
          (this.lbl_shuxing_gongji.text = "攻击：" + Global.roleAp),
          (this.lbl_shuxing_sudu.text = "速度：" + Global.roleSp),
          this.MainHeroUI();
      }),
      (e.prototype.onPropertyDidClick = function (t) {
        if ("item1" == t.target.name) {
          (e = parseInt(this.lbl_one_num.text)) - 10 < 0 ? (e = 0) : (e -= 10),
            this.caclutePropertyPointWithOne(e);
        } else if ("item2" == t.target.name) {
          if ((e = parseInt(this.lbl_one_num.text)) - 1 < 0) return;
          (e -= 1), this.caclutePropertyPointWithOne(e);
        } else if ("item3" == t.target.name) {
          e = parseInt(this.lbl_one_num.text);
          if (this.shengyudianshu() < 1) return;
          (e += 1), this.caclutePropertyPointWithOne(e);
        } else if ("item4" == t.target.name) {
          var e = parseInt(this.lbl_one_num.text);
          this.shengyudianshu() < 10 && this.shengyudianshu() >= 0
            ? (e += this.shengyudianshu())
            : (e += 10),
            this.caclutePropertyPointWithOne(e);
        } else if ("item5" == t.target.name) {
          (i = parseInt(this.lbl_two_num.text)) - 10 < 0 ? (i = 0) : (i -= 10),
            this.caclutePropertyPointWithTwo(i);
        } else if ("item6" == t.target.name) {
          if ((i = parseInt(this.lbl_two_num.text)) - 1 < 0) return;
          (i -= 1), this.caclutePropertyPointWithTwo(i);
        } else if ("item7" == t.target.name) {
          i = parseInt(this.lbl_two_num.text);
          if (this.shengyudianshu() < 1) return;
          (i += 1), this.caclutePropertyPointWithTwo(i);
        } else if ("item8" == t.target.name) {
          var i = parseInt(this.lbl_two_num.text);
          this.shengyudianshu() < 10 && this.shengyudianshu() >= 0
            ? (i += this.shengyudianshu())
            : (i += 10),
            this.caclutePropertyPointWithTwo(i);
        } else if ("item9" == t.target.name) {
          (n = parseInt(this.lbl_three_num.text)) - 10 < 0
            ? (n = 0)
            : (n -= 10),
            this.caclutePropertyPointWithThree(n);
        } else if ("item10" == t.target.name) {
          if ((n = parseInt(this.lbl_three_num.text)) - 1 < 0) return;
          (n -= 1), this.caclutePropertyPointWithThree(n);
        } else if ("item11" == t.target.name) {
          n = parseInt(this.lbl_three_num.text);
          if (this.shengyudianshu() < 1) return;
          (n += 1), this.caclutePropertyPointWithThree(n);
        } else if ("item12" == t.target.name) {
          var n = parseInt(this.lbl_three_num.text);
          this.shengyudianshu() < 10 && this.shengyudianshu() >= 0
            ? (n += this.shengyudianshu())
            : (n += 10),
            this.caclutePropertyPointWithThree(n);
        } else if ("item13" == t.target.name) {
          (o = parseInt(this.lbl_four_num.text)) - 10 < 0 ? (o = 0) : (o -= 10),
            this.caclutePropertyPointWithFour(o);
        } else if ("item14" == t.target.name) {
          if ((o = parseInt(this.lbl_four_num.text)) - 1 < 0) return;
          (o -= 1), this.caclutePropertyPointWithFour(o);
        } else if ("item15" == t.target.name) {
          o = parseInt(this.lbl_four_num.text);
          if (this.shengyudianshu() < 1) return;
          (o += 1), this.caclutePropertyPointWithFour(o);
        } else if ("item16" == t.target.name) {
          var o = parseInt(this.lbl_four_num.text);
          this.shengyudianshu() < 10 && this.shengyudianshu() >= 0
            ? (o += this.shengyudianshu())
            : (o += 10),
            this.caclutePropertyPointWithFour(o);
        }
      }),
      (e.prototype.reslutPoint = function () {
        var t = this.currentValue_one - this.one_MinValue,
          e = this.currentValue_two - this.two_MinValue,
          i = this.currentValue_three - this.three_MinValue,
          n = this.currentValue_four - this.four_MinValue,
          o = this.restValue - t - e - i - n;
        return o <= 0 && (o = 0), o;
      }),
      (e.prototype.shengyudianshu = function () {
        var t = parseInt(this.lbl_one_num.text),
          e = parseInt(this.lbl_two_num.text),
          i = parseInt(this.lbl_three_num.text),
          n = parseInt(this.lbl_four_num.text),
          o = this.restValue - t - e - i - n;
        return o <= 0 && (o = 0), (this.lbl_rest_shuxing.text = o + ""), o;
      }),
      (e.prototype.caclutePropertyPointWithOne = function (t) {
        (this.lbl_one_num.text = t + ""),
          (this.lbl_shuxing_tizhi.text = this.one_MinValue + ""),
          (this.lbl_one_current.text = "（+" + t + "）"),
          this.shengyudianshu();
      }),
      (e.prototype.caclutePropertyPointWithTwo = function (t) {
        (this.lbl_two_num.text = t + ""),
          (this.lbl_shuxing_zhilidian.text = "" + this.two_MinValue),
          (this.lbl_two_current.text = "（+" + t + "）"),
          this.shengyudianshu();
      }),
      (e.prototype.caclutePropertyPointWithThree = function (t) {
        (this.lbl_three_num.text = t + ""),
          (this.lbl_shuxing_liliangdian.text = this.three_MinValue + ""),
          (this.lbl_three_current.text = "（+" + t + "）"),
          this.shengyudianshu();
      }),
      (e.prototype.caclutePropertyPointWithFour = function (t) {
        (this.lbl_four_num.text = t + ""),
          (this.lbl_shuxing_minjiedian.text = this.four_MinValue + ""),
          (this.lbl_four_current.text = "（+" + t + "）"),
          this.shengyudianshu();
      }),
      (e.close = function () {
        this.propertyView && this.propertyView.close();
      }),
      (e.prototype.onAddPropertyPointFn = function () {
        var t = parseInt(this.lbl_one_num.text),
          e = parseInt(this.lbl_two_num.text),
          i = parseInt(this.lbl_three_num.text),
          n = parseInt(this.lbl_four_num.text);
        if (1 == this.obj_type) {
          if (0 == i && 0 == t && 0 == e && 0 == n) return void this.close();
          NormalDialog.showNormalDialog(
            "您确定这样分配吗？",
            this,
            this.okMethodFunction
          ),
            (this.distribute_state = !0);
        } else {
          if (0 == i && 0 == t && 0 == e && 0 == n) return void this.close();
          NormalDialog.showNormalDialog(
            "您确定这样分配吗？",
            this,
            this.okMethodFunction
          );
        }
        this.close();
      }),
      (e.prototype.okMethodFunction = function () {
        var t = parseInt(this.lbl_one_num.text),
          e = parseInt(this.lbl_two_num.text),
          i = parseInt(this.lbl_three_num.text),
          n = parseInt(this.lbl_four_num.text);
        1 == this.obj_type
          ? (WebSocketService.send({
              c: 1005,
              d: { ap: i, hp: t, mp: e, sp: n },
            }),
            this.MainHeroUI())
          : (WebSocketService.send({
              c: 1105,
              d: { id: this.objJson.id, ap: i, hp: t, mp: e, sp: n },
            }),
            this.SubHeroUI());
      }),
      (e.prototype.onCancleFn = function () {
        1 == this.obj_type ? this.MainHeroUI() : this.SubHeroUI(), this.close();
      }),
      (e.one_baseNum = 360),
      (e.two_baseNum = 200),
      (e.three_baseNum = 80),
      (e.four_baseNum = 10),
      e
    );
  })(ui.SuboardinateController.AXPropertyViewUI);
